Skip to content

ci: read GITHUB_REF from the environment, version the package from the tag - #504

Merged
erwan-joly merged 1 commit into
masterfrom
infra/release-hardening
Aug 30, 2026
Merged

ci: read GITHUB_REF from the environment, version the package from the tag#504
erwan-joly merged 1 commit into
masterfrom
infra/release-hardening

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Same hardening as applied across the other package repos (flagged by review on NosCoreIO/NosCore.Shared#260):

  • ${{ github.ref }} interpolated into the Bash [[ ... =~ ]] check is evaluated by the shell before the regex filters it — a tag like 1.2.3$(...) would execute on a runner that holds the NuGet API key. Reading $GITHUB_REF from the environment removes the injection point.
  • dotnet pack -p:PackageVersion=${TAG_NAME} — the pushed filename is derived from the tag, so the package version must match it; previously a tag that didn't match the csproj version made dotnet nuget push fail on a missing file (the usual "bump csproj before tagging" dance).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved release package version detection from Git tags.
    • Ensured packaged .NET artifacts use the correct tag-based version.
    • Updated version format validation for more reliable releases.

…e tag

Interpolating github.ref into the Bash source lets a crafted tag execute
shell code on a runner holding the NuGet key before the regex check
runs; reading $GITHUB_REF from the environment removes the injection
point. PackageVersion now comes from the tag so a tag no longer has to
match the csproj version for the push path to exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c5639fc5-06a9-4678-8a9f-e62d3c56f843

📥 Commits

Reviewing files that changed from the base of the PR and between 73b1240 and e7d153b.

📒 Files selected for processing (1)
  • .github/workflows/dotnet.yml

Walkthrough

The GitHub Actions workflow now reads the release tag from GITHUB_REF, uses an unescaped-dot version pattern, and sets the package version explicitly during dotnet pack.

Changes

Package versioning

Layer / File(s) Summary
Tag validation and package versioning
.github/workflows/dotnet.yml
The workflow reads the tag from GITHUB_REF, updates the version pattern, and passes TAG_NAME as PackageVersion to dotnet pack.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch infra/release-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@erwan-joly
erwan-joly merged commit 2b382a6 into master Aug 30, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant